package com.epfresh.supplier.entity;

import android.util.Log;

import java.util.List;

public class ProductConfigs {

    //    {
//        "id": 279,
//            "title": "测试图片2",
//            "price": 1,
//            "thumbnail": "http://7xpf2j.com2.z0.glb.qiniucdn.com/2016%2F7%2F30%2F852f661048df423fa0e696feea974894.jpg-PRODUCTTHUMBNAIL",
//            "cities": [
//        {
//            "name": "南通市",
//                "code": 3206
//        }
//        ],
//        "status": 1,
//            "statusStr": "已上架",
//            "type": 1,
//            "packageContainer": "箱",
//            "packageUnit": "公斤",
//            "packageSize": 21
//    }
//

    /*promotion:[{
        price:"",//价格
                quantityPerAccount:"",//限购数量
                totalQuantity:"",//总数量
                beginTime:"",//开始日期
                endTime:"",//结束日期
                type:"",//1，促销；2，秒杀
                promotionItem:[
        {
            beginTime:"",//开始时间
                    endTime:"",//结束时间
                buyQuantity:""//购买数量：从订单取
        },
        {场次2}
				]*/
    private float price;
    private String statusStr;
    private String packageContainer = "";
    private String packageUnit = "";
    private String packageSize;
    private String deliveryTime;
    private List<CityDeliveryWay> cities;


    private List<ProductConfigsConfigs> configs;
    private String thumbnail;
    private String id;
    private String auditStatus;
    private String title;
    private int type;
    private int status;
    private String productChargeUnit;
    private String spec;
    private String moq = "";
    private String inventory = "";
    private String chargeUnit;
    private List<Promotion> promotion;

    private double incr;

    public String getAuditStatus() {
        return auditStatus;
    }

    public void setAuditStatus(String auditStatus) {
        this.auditStatus = auditStatus;
    }

    public boolean isRefuseStatus(){
        return "2".equals(auditStatus);
    }
    public List<Promotion> getPromotion() {
        return promotion;
    }

    public double getIncr() {
        return incr;
    }

    public void setIncr(double incr) {
        this.incr = incr;
    }

    public void setPromotion(List<Promotion> promotion) {
        this.promotion = promotion;
    }


    public String getChargeUnit() {
        return chargeUnit;
    }

    public void setChargeUnit(String chargeUnit) {
        this.chargeUnit = chargeUnit;
    }

    public String getDeliveryTime() {
        return deliveryTime == null ? "" : deliveryTime;
    }

    public void setDeliveryTime(String deliveryTime) {
        this.deliveryTime = deliveryTime;
    }

    public String getInventory() {
        return inventory==null?"0":inventory;
    }

    public void setInventory(String inventory) {
        this.inventory = inventory;
    }

    public List<ProductConfigsConfigs> getConfigs() {
        return configs;
    }

    public void setConfigs(List<ProductConfigsConfigs> configs) {
        this.configs = configs;
    }

    public String getThumbnail() {
        return thumbnail;
    }

    public void setThumbnail(String thumbnail) {
        this.thumbnail = thumbnail;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getProductChargeUnit() {
        return productChargeUnit;
    }

    public void setProductChargeUnit(String productChargeUnit) {
        this.productChargeUnit = productChargeUnit;
    }

    public String getSpec() {
        return spec;
    }

    public void setSpec(String spec) {
        this.spec = spec;
    }


    public float getPrice() {
        return price;
    }

    public void setPrice(float price) {
        this.price = price;
    }

    public String getStatusStr() {
        return statusStr;
    }

    public void setStatusStr(String statusStr) {
        this.statusStr = statusStr;
    }

    public String getPackageContainer() {
        return packageContainer;
    }

    public void setPackageContainer(String packageContainer) {
        this.packageContainer = packageContainer;
    }

    public String getPackageUnit() {
        return packageUnit;
    }

    public void setPackageUnit(String packageUnit) {
        this.packageUnit = packageUnit;
    }

    public String getPackageSize() {
        return packageSize;
    }

    public void setPackageSize(String packageSize) {
        this.packageSize = packageSize;
    }

    public List<CityDeliveryWay> getCities() {
        return cities;
    }

    public void setCities(List<CityDeliveryWay> cities) {
        this.cities = cities;
    }

    public String getMoq() {
        return moq;
    }

    public void setMoq(String moq) {
        this.moq = moq;
    }

    public String getCityStr() {
        String cityName = "";
        if (cities != null) {
            for (CityDeliveryWay city :
                    cities) {

                cityName += city.getName() + " ";

            }


        }
        return cityName;
    }


    public String getPriceStr() {
        if (chargeUnit == null) {
            chargeUnit = "";
        }
        return String.format("%.2f", price) + "元/" + chargeUnit;
    }

    public String getMinStr() {

        if (chargeUnit == null) {
            chargeUnit = "";
        }
        return moq + chargeUnit + "起订";

    }

    public String getUnitStr() {
        if ("散货".equals(packageContainer) || "".equals(packageContainer)) {
            return packageUnit == null ? "" : packageUnit;
        } else {
            return packageContainer == null ? "" : packageContainer;
        }
    }

    public String getPackageStr() {
        if ("散货".equals(packageContainer) || "".equals(packageContainer)) {
            return /*packageSize + packageUnit*/"";
        } else {
            return packageSize + packageUnit + "/" + packageContainer;
        }
    }



    @Override
    public String toString() {
        return "ProductConfigs{" +
                "price=" + price +
                ", statusStr='" + statusStr + '\'' +
                ", packageContainer='" + packageContainer + '\'' +
                ", packageUnit='" + packageUnit + '\'' +
                ", packageSize='" + packageSize + '\'' +
                ", deliveryTime='" + deliveryTime + '\'' +
                ", cities=" + cities +
                ", configs=" + configs +
                ", thumbnail='" + thumbnail + '\'' +
                ", id='" + id + '\'' +
                ", title='" + title + '\'' +
                ", type=" + type +
                ", status=" + status +
                ", productChargeUnit='" + productChargeUnit + '\'' +
                ", spec='" + spec + '\'' +
                ", moq='" + moq + '\'' +
                ", inventory='" + inventory + '\'' +
                ", chargeUnit='" + chargeUnit + '\'' +
                ", promotion=" + promotion +
                '}';
    }
}
